import myfetch from "../assets/myfetch"
import token from "./token"
import use from "./user"
let user = use.getMyInfo()
export default {
  upload: (file) => {
    let fd = new FormData();
    fd.append("file", file);
    return myfetch.myupload(`/upload/upload`, {
      timer: token.getTimer(),
      fromid: user.id
    }, {
      body: fd
    }).then(
      (res) => {
        return res.json()
      }
    )
  },
  otherWhere(filename, fileurl, filetype) {
    let param = {
      filename,
      fileurl,
      fromid: user.id,
      filetype
    }
    return myfetch.myget('/upload/otherWhere', param)
  }
}
